 

ii=figure;
colors=[1 0 1;0 0 1;1 0 0;1 1 0;0 1 0;0 1 1;0.5 1 0.5;0 0 0;0 0 0;0 0 0;];

corr_site=struct('M',[0],'P',[0]);

for site=1:size(proj_meta,2);%[1:3,5:size(proj_meta,2)]
no_time_points = size(proj_meta(site).rd,2);

act=[];
type_sessions={'f','p','d'};
mean_act=[];
mean_act_run=[];
sem_act=[];
for tp=1:no_time_points
    act=[];
    for lyr=1:size(proj_meta(site).rd,1)
        act=[act; proj_meta(site).rd(lyr,tp).act];
    end
%         act=act(max(act')>2,:);
    sess_start=proj_meta(site).rd(lyr,tp).nbr_frames;
    sess_start=cumsum(sess_start);
    sess_start=[1 sess_start+1];
    velM = proj_meta(site).rd(lyr,tp).velM_smoothed;
    velP = proj_meta(site).rd(lyr,tp).velP_smoothed;
    
    ac_sess=find(strcmp(proj_meta(site).rd(lyr,tp).session,type_sessions(2))==1);
    indices=[];
    for kk=1:length(ac_sess)
        indices=[indices sess_start(ac_sess(kk)):sess_start(ac_sess(kk)+1)-1];
    end
    for jj=1:size(act,1);
        corr_site(site).M(jj)=corr2(act(jj,indices),velM(indices));
        corr_site(site).P(jj)=corr2(act(jj,indices),velP(indices));
    end
    mean_corr_site(1,site)=mean(corr_site(site).M);
    mean_corr_site(2,site)=mean(corr_site(site).P);
    
end

figure(ii);
hold on 
plot(corr_site(site).M,corr_site(site).P,'.','Color',colors(site,:))
end


